fix(@angular/ssr): introduce DI token to signal route discovery process#32491
fix(@angular/ssr): introduce DI token to signal route discovery process#32491alan-agius4 merged 1 commit intoangular:mainfrom
Conversation
dgp1130
left a comment
There was a problem hiding this comment.
LGTM.
My personal opinion is that we would want to discourage overall use of this token as I think server startup should be generally cheap, hermetic, and stable (in the sense that it does the same thing every time). If you rely on unique runtime dependencies which you don't need for route discovery and are problematic for that use case, I feel like there are potentially better ways to accomplish what most developers need.
That said, reality is always messy and I can see cases where this is useful or Angular is lacking the higher-level APIs which might be a better fit, so no objection from me on landing this.
dgp1130
left a comment
There was a problem hiding this comment.
Actually one other thought: Can we have a test somewhere that discovering routes sets this token correctly while SSR/CSR does not?
|
Hi Team, since the PR was approved last week, is there a chance we could squeeze it into 21.2.0? |
5dc365a to
f81c80f
Compare
A new DI token, `IS_DISCOVERING_ROUTES`, is introduced to provide a clear signal for when the application is operating in route discovery mode. This token is provided with the value `true` within the route extraction providers. Other services and components can inject this token to conditionally alter their behavior, for instance, to disable functionality that is not required or could interfere with the route discovery process. Closes angular#32474
f81c80f to
09cac2e
Compare
A new DI token,
IS_DISCOVERING_ROUTES, is introduced to provide a clear signal for when the application is operating in route discovery mode. This token is provided with the valuetruewithin the route extraction providers. Other services and components can inject this token to conditionally alter their behavior, for instance, to disable functionality that is not required or could interfere with the route discovery process.Closes #32474